const amapKey = '6c631d42937ac58817bc7167fe58f3a5';

async function placeText(params: { location?: [number, number]; keywords?: string }) {
  let queryString = `key=${amapKey}`;
  const { keywords } = params;
  if (keywords) queryString = queryString.concat(`&keywords=${keywords}`);
  const response = await fetch(`https://restapi.amap.com/v3/place/text?${queryString}`);
  return response.json();
}

export { amapKey, placeText };
